package com.example.web.controller;

import com.example.common.response.R;
import com.example.system.domain.Bo.PageBo;
import com.example.system.domain.Config;
import com.example.system.domain.Vo.PageVo;
import com.example.system.service.ConfigService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@Api(value = "参数管理管理", tags = {"参数管理管理"})
@RequestMapping(value = "/config", method = {RequestMethod.POST, RequestMethod.GET})
public class ConfigController {

    @Autowired
    private ConfigService configService;

    @ResponseBody
    @ApiOperation("获取参数")
    @RequestMapping("/{key}")
    public R<Config> getConfig(@PathVariable("key") String key) {
        return R.ok(configService.getByKey(key));
    }

    @ResponseBody
    @ApiOperation("获取参数列表")
    @RequestMapping("/getList")
    public R<PageVo<Config>> getList(@RequestBody PageBo pageBo) {
        return R.ok(configService.getList(pageBo));
    }

}
